/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.kai.zhouzhi.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Kenny Lin
 */
@Entity
@Table(name = "article_cate", catalog = "nature", schema = "")
@NamedQueries({
    @NamedQuery(name = "ArticleCate.findAll", query = "SELECT a FROM ArticleCate a"),
    @NamedQuery(name = "ArticleCate.findByArticleCateId", query = "SELECT a FROM ArticleCate a WHERE a.articleCateId = :articleCateId"),
    @NamedQuery(name = "ArticleCate.findByArticleCateName", query = "SELECT a FROM ArticleCate a WHERE a.articleCateName = :articleCateName"),
    @NamedQuery(name = "ArticleCate.findByArticleCateDesc", query = "SELECT a FROM ArticleCate a WHERE a.articleCateDesc = :articleCateDesc")})
public class ArticleCate implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "article_cate_id", nullable = false)
    private Integer articleCateId;
    @Basic(optional = false)
    @Column(name = "article_cate_name", nullable = false, length = 20)
    private String articleCateName;
    @Column(name = "article_cate_desc", length = 400)
    private String articleCateDesc;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "articleCateId", fetch = FetchType.EAGER)
    private List<Article> articleList;

    public ArticleCate() {
    }

    public ArticleCate(Integer articleCateId) {
        this.articleCateId = articleCateId;
    }

    public ArticleCate(Integer articleCateId, String articleCateName) {
        this.articleCateId = articleCateId;
        this.articleCateName = articleCateName;
    }

    public Integer getArticleCateId() {
        return articleCateId;
    }

    public void setArticleCateId(Integer articleCateId) {
        this.articleCateId = articleCateId;
    }

    public String getArticleCateName() {
        return articleCateName;
    }

    public void setArticleCateName(String articleCateName) {
        this.articleCateName = articleCateName;
    }

    public String getArticleCateDesc() {
        return articleCateDesc;
    }

    public void setArticleCateDesc(String articleCateDesc) {
        this.articleCateDesc = articleCateDesc;
    }

    public List<Article> getArticleList() {
        return articleList;
    }

    public void setArticleList(List<Article> articleList) {
        this.articleList = articleList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (articleCateId != null ? articleCateId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ArticleCate)) {
            return false;
        }
        ArticleCate other = (ArticleCate) object;
        if ((this.articleCateId == null && other.articleCateId != null) || (this.articleCateId != null && !this.articleCateId.equals(other.articleCateId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.kai.zhouzhi.entity.ArticleCate[articleCateId=" + articleCateId + "]";
    }

}
